<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>CSSOM - CSSPageRule - selectors</title>
    <link rel="author" title="Glenn Adams" href="mailto:glenn@skynav.com"/>
    <link rel="help" href="http://www.w3.org/TR/cssom/#the-csspagerule-interface"/>
    <meta name="flags" content="dom"/>
    <script src="/resources/testharness.js"/>
    <script src="/resources/testharnessreport.js"/>
    <style id="sheet1">
      @page :first {
      }
    </style>
    <style id="sheet2">
      @page :left {
      }
    </style>
    <style id="sheet3">
      @page :right {
      }
    </style>
  </head>
  <body>
    <div id="log"></div>
    <div id="box"></div>
    <script><![CDATA[

      var doc = window.document;

      var sheets = doc.styleSheets;

      var rule;

      test(function(){

        assert_equals(sheets.length, 3);

      }, 'doc.styleSheets.length == 3');

      rule = sheets[0].cssRules[0];

      test(function(){

        assert_true(rule instanceof CSSPageRule);

      }, 'doc.styleSheets[0].cssRules[0] instanceof CSSPageRule');

      test(function(){

        assert_equals(rule.selectorText, ':first');

      }, 'doc.styleSheets[0].cssRules[0].selectorText == \':first\'');

      test(function(){

        assert_equals(rule.cssText, '@page :first { }');

      }, 'doc.styleSheets[0].cssRules[0].cssText == \'@page :first { }\'');

      rule = sheets[1].cssRules[0];

      test(function(){

        assert_true(rule instanceof CSSPageRule);

      }, 'doc.styleSheets[1].cssRules[0] instanceof CSSPageRule');

      test(function(){

        assert_equals(rule.selectorText, ':left');

      }, 'doc.styleSheets[0].cssRules[0].selectorText == \':left\'');

      test(function(){

        assert_equals(rule.cssText, '@page :left { }');

      }, 'doc.styleSheets[1].cssRules[0].cssText == \'@page :left { }\'');

      rule = sheets[2].cssRules[0];

      test(function(){

        assert_true(rule instanceof CSSPageRule);

      }, 'doc.styleSheets[2].cssRules[0] instanceof CSSPageRule');

      test(function(){

        assert_equals(rule.selectorText, ':right');

      }, 'doc.styleSheets[0].cssRules[0].selectorText == \':right\'');

      test(function(){

        assert_equals(rule.cssText, '@page :right { }');

      }, 'doc.styleSheets[2].cssRules[0].cssText == \'@page :right { }\'');

    ]]>
    </script>
  </body>
</html>
